package com.cilibo.neo4jdemo.model;

import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.neo4j.core.schema.GeneratedValue;
import org.springframework.data.neo4j.core.schema.Id;
import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.Property;
import org.springframework.data.neo4j.core.schema.Relationship;

import java.util.HashSet;
import java.util.Set;

@Data
@Node
@Accessors(chain = true)
public class Person {
    @Id
    @GeneratedValue
    private Long id;

    @Property(name = "name")
    private String name;

    @Relationship(type = "好友", direction = Relationship.Direction.OUTGOING)
    private Set<Person> friends = new HashSet<>();

    @Relationship(type = "家人", direction = Relationship.Direction.OUTGOING)
    private Set<Person>  family = new HashSet<>();
}
